package com.luke.springcloud.healthcheck;

import com.luke.springcloud.controller.EurekaClientController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.actuate.health.Status;
import org.springframework.stereotype.Component;

/**
 * @Descrtption MyHealthIndicator
 * @Author luke
 * @Date 2020/4/21
 **/
@Slf4j
@Component
public class MyHealthIndicator implements HealthIndicator {

    @Override
    public Health health() {
        //log.info("state: {}",EurekaClientController.SERVICE_STATE);
        if(EurekaClientController.SERVICE_STATE){
            return new Health.Builder(Status.UP).build();
        }else{
            return new Health.Builder(Status.DOWN).build();
        }
    }

}
